home *** CD-ROM | disk | FTP | other *** search
/ Playboy Electronic Datebook / Playboy Electronic Datebook - Disk 2.img / PBINST.MS_ / PBINST.MS
Encoding:
Text File  |  1993-10-22  |  45.9 KB  |  1,221 lines

  1.  
  2. '**************************************************************************
  3. '*                 THEME Install
  4. '**************************************************************************
  5.  
  6. '' not defined
  7. ''$DEFINE DEBUG  ''Define for script development/debugging
  8. '$DEFINE CONFIRM
  9. ''$DEFINE VERSION
  10. ''$DEFINE REMOVE
  11. ''$DEFINE MONTHS
  12. ''$DEFINE CHANGEDATE
  13. ''$DEFINE INTL
  14. ''$DEFINE INTL_UK
  15. ''$DEFINE CONVERSION
  16. '$DEFINE JOINFILES
  17.  
  18. '$INCLUDE 'setupapi.inc'
  19. '$INCLUDE 'msdetect.inc'
  20. '$INCLUDE 'strings.inc'
  21. '$INCLUDE 'pbinst.inc'
  22. '$INCLUDE 'misc.inc'
  23.  
  24. '$IFDEF CONVERSION
  25.     Declare Function GetPrivateProfileString Lib "Kernel" (lpApplicationName$, lpKeyName$, lpDefault$, lpReturnedString$, nSize%, lpFileName$) As Integer
  26.     Declare Function WritePrivateProfileString Lib "Kernel" (lpApplicationName$, lpKeyName$, lpString$, lplFileName$) As Integer
  27. '$ENDIF
  28.  
  29. '$IFDEF JOINFILES
  30.     Declare Function ConcatenateFiles Lib "CONCAT.DLL" (lpFile1$, lpFile2$, lpFileJoined$) As Integer
  31. '$ENDIF
  32.  
  33.  
  34.  
  35. CONFIRMTEXTIN$ = "ConfirmTextIn"
  36. FOR i% = 1 TO 2 STEP 1
  37.     AddListItem CONFIRMTEXTIN$, ""
  38. NEXT i%
  39.  
  40.  
  41.  
  42. GLOBAL pStrOptBuf AS POINTER TO STRING *256
  43. GLOBAL pStrTxtBuf AS POINTER TO STRING *256
  44.  
  45. GLOBAL bFileSplit%
  46.  
  47. ''Initialize BadFileList
  48.     BadFileList$ = "BadFileList"
  49.  
  50. ''________________________________________________________________
  51. ''
  52.  
  53. '$IFDEF DEBUG
  54.     ECHO ON  ''sends output to debug monitor
  55. '$ELSE
  56.     ECHO OFF
  57. '$ENDIF
  58.  
  59. INIT:
  60.     bFileSplit% = FALSE
  61.  
  62.     CUIDLL$ = CUSTOMDLL                 ''custom user interface dll
  63.     HELPPROC$ = HELPPROCEDURE          ''Help dialog procedure
  64.     SYSDATETIME$ = DATETIME$            ''Get system date and time
  65.  
  66.     SetAbout ABOUTTITLE1, ABOUTTITLE2
  67.     SetBitmap CUIDLL$, LOGO
  68.     SetTitle ABOUTTITLE1
  69.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  70.  
  71.   ''*** check if ADP is running, err quit if it is
  72.     bIsADPRunning% = FindWindow(CLASSNAME_PBEDB, 0)
  73.     IF bIsADPRunning% THEN
  74.         iRC% = DoMsgBox(ERROR_ADP_RUNNING, ERROR_CAPTION, MB_ICONHAND+MB_TASKMODAL+MB_OK)
  75.         ERR = ERR_FAIL
  76.         GOTO QUIT
  77.     END IF
  78.  
  79.  
  80.     szInstIni$ = GetSymbolValue("STF_CWDDIR") + INSTINI
  81.     '' Debug PRINT szInstIni$
  82.     THEME$ = GetIniKeyString(szInstIni$, INI_SEC_INFORMATION, INI_KEY_THEME)
  83.     '' Debug PRINT THEME$
  84.     iNumMonths% = VAL(GetIniKeyString(szInstIni$, INI_SEC_INFORMATION, INI_KEY_NUMMONTHS ))
  85.     iNumFiles% = VAL(GetIniKeyString(szInstIni$, INI_SEC_INFORMATION, INI_KEY_NUMFILES ))
  86.     bThemeFileType%= VAL(GetIniKeyString(szInstIni$, INI_SEC_INFORMATION, INI_KEY_IS_SINGLE_FILE))
  87.     bAnimations% = VAL(GetIniKeyString(szInstIni$, INI_SEC_INFORMATION, INI_KEY_ANIMATIONS))
  88.     bColor% = VAL(GetIniKeyString(szInstIni$, INI_SEC_INFORMATION, INI_KEY_COLORDATA ))
  89.     bThemeFormat% = VAL(GetIniKeyString(szInstIni$, INI_SEC_INFORMATION, INI_KEY_QUESTION ))
  90.     bDDOnDay% = VAL(GetIniKeyString(szInstIni$, INI_SEC_INFORMATION, INI_KEY_DDONDAY ))
  91.     bWriteComm% = VAL(GetIniKeyString(szInstIni$, INI_SEC_INFORMATION, INI_KEY_WRITECOMM ))
  92.     bForceWriteDay% = VAL(GetIniKeyString(szInstIni$, INI_SEC_INFORMATION, INI_KEY_FORCE_DAY_ZERO ))
  93.     bWriteNumMonths% = VAL(GetIniKeyString(szInstIni$, INI_SEC_INFORMATION, INI_KEY_WRITE_NUM_MONTHS ))
  94.     cNMTD$ = GetIniKeyString(szInstIni$, INI_SEC_INFORMATION, INI_KEY_NMTD )
  95.     bTCODEDDD% = VAL(GetIniKeyString(szInstIni$, INI_SEC_INFORMATION, INI_KEY_TCODEDDD ))
  96.     bFindADP% = VAL(GetIniKeyString(szInstIni$, INI_SEC_INFORMATION, INI_KEY_FINDADP ))
  97.     SPLASH% = VAL(GetIniKeyString(szInstIni$, INI_SEC_INFORMATION, INI_KEY_SPLASH))
  98.     szThemeResID$ = GetIniKeyString(szInstIni$, INI_SEC_INFORMATION, INI_KEY_THEME_RES_ID)
  99.     WELCOME_TEXT1$ = GetIniKeyString(szInstIni$, INI_SEC_INFORMATION, INI_KEY_WEL_TEXT1)
  100.     WELCOME_TEXT1PT2$ = GetIniKeyString(szInstIni$, INI_SEC_INFORMATION, INI_KEY_WEL_TEXT1PT2)
  101.     WELCOME_TEXT2$ = GetIniKeyString(szInstIni$, INI_SEC_INFORMATION, INI_KEY_WEL_TEXT2)
  102.     WELCOME_TEXT2PT2$ = GetIniKeyString(szInstIni$, INI_SEC_INFORMATION, INI_KEY_WEL_TEXT2PT2)
  103.     szExpireText$ = GetIniKeyString(szInstIni$, INI_SEC_INFORMATION, INI_KEY_EXPIRE_TEXT)
  104.     RES_TEXT_XGA$ = GetIniKeyString(szInstIni$, INI_SEC_INFORMATION, INI_KEY_RES_TEXT_XGA)
  105.     RES_TEXT_VGA$ = GetIniKeyString(szInstIni$, INI_SEC_INFORMATION, INI_KEY_RES_TEXT_VGA)
  106.     RES_TEXT_EGA$ = GetIniKeyString(szInstIni$, INI_SEC_INFORMATION, INI_KEY_RES_TEXT_EGA)
  107.     bDDDInData% = VAL(GetIniKeyString(szInstIni$, INI_SEC_INFORMATION, INI_KEY_DDDINDATA ))
  108.     bFileSplit% = VAL(GetIniKeyString(szInstIni$, INI_SEC_INFORMATION, INI_KEY_FILESPLIT ))
  109.     bNoExpire% = VAL(GetIniKeyString(szInstIni$, INI_SEC_INFORMATION, INI_KEY_NOEXPIRE ))
  110.     bMasterInCommon% = VAL(GetIniKeyString(szInstIni$, INI_SEC_INFORMATION, INI_KEY_MASTERINCOMMON ))
  111.     iNMTD% = ASC(cNMTD$) - ASC("A") + 1
  112.  
  113.     '' need to artificially touch a file so that it gets current date.
  114.     CreateIniKeyValue szInstIni$, INI_KEY_DATE, INI_KEY_DATE, INI_KEY_DATE, cmoOverwrite
  115.     RemoveIniKey szInstIni$, INI_KEY_DATE, INI_KEY_DATE, 0
  116.     SYSDATETIME$ = GetDateOfFile(szInstIni$)
  117.     '' Debug PRINT SYSDATETIME$
  118.  
  119.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  120.     IF szInf$ = "" THEN
  121.     szInf$ = GetSymbolValue("STF_CWDDIR") + INF
  122.     END IF
  123.     '' Debug PRINT "szInf$ = "+szInf$
  124.     ReadInfFile szInf$
  125.  
  126.     WINDRIVE$ = MID$(GetWindowsDir(), 1, 1)
  127.     ini$ = MakePath(GetWindowsDir(), AMAZEINI)
  128.  
  129. ''*** Check if Amaze.ini is read/writeable.  Quit if it is not.  If it doesn't exist, don't worry about it
  130.     IF DoesFileExist(ini$, femExists) THEN
  131.         IF DoesFileExist(ini$, femReadWrite) = 0 THEN
  132.             iRC% = DoMsgBox(ini$ + ERROR_INI_NOT_RW, ERROR_CAPTION, MB_ICONHAND+MB_TASKMODAL+MB_OK)
  133.             ERR = -21  '' install failure
  134.             goto QUIT
  135.         END IF
  136.     END IF
  137. ''*** Setup initial default path
  138.     DEST$ = FindTargetOnEnvVar(FILENAME_PBEDB, ENV_VAR_PATH)
  139.     IF DEST$ <> "" THEN
  140.         SPLITPATH DEST$, szDRV$, szDIR$, szFileName$, szEXT$
  141.         DEST$ = szDRV$ + szDIR$
  142.     ELSE
  143.         IF DoesIniKeyExist(ini$, INI_SEC_INSTALL_INFO, INI_KEY_PROGPATH) THEN
  144.             DEST$ = GetIniKeyString(ini$, INI_SEC_INSTALL_INFO, INI_KEY_PROGPATH)
  145.             IF (DoesFileExist(MakePath(DEST$,FILENAME_PBEDB), femExists)) THEN
  146.                 DEST$ = DEST$
  147.             ELSE
  148.                 DEST$ = WINDRIVE$ + ":\" + PROGDIR
  149.             END IF
  150.         ELSE
  151.             DEST$ = WINDRIVE$ + ":\" + PROGDIR
  152.         END IF
  153.     ENDIF
  154.     PARTTHEMEDEST$ = GetIniKeyString(szInstIni$, INI_SEC_INFORMATION, INI_KEY_DEFAULTDIR)
  155.     THEMEDEST$ = MakePath(DEST$, PARTTHEMEDEST$)
  156.     iMaxNumTP% = MAX_NUM_THEMES
  157.  
  158.     bThemeExists% = FALSE     '' won't allow updating of dll if dll exists
  159. ''**** Get the Drop Dead Date *************************************
  160. ''** The next section attempts to get a DDD from the theme pack, if it is not there
  161. ''** and CONVERSION is defined, it looks to find a special edition theme pack. If
  162. ''** that isn't there it will create a new DDD by modifying a file and grabbing the date
  163. ''**
  164. ''*****
  165. ''** 7/7/93  - Modified to use DATA file instead of master
  166. ''**
  167.     IF DoesIniKeyExist(ini$, THEME$, INI_KEY_DATA) THEN
  168.         IF DoesFileExist (GetIniKeyString(ini$, THEME$, INI_KEY_DATA), femReadWrite) THEN
  169.             IF bNoExpire% = TRUE THEN
  170.                 bThemeExists% = TRUE
  171.             ELSE
  172.                 '' get drop dead date
  173.                 DDDate$ = STRING$(32, 32) '' 32 spaces - result buffer
  174.                 IF bDDOnDay% = TRUE THEN
  175.                     DDDateDay$ = STRING$(32,32)
  176.                 END IF
  177.                 '' Debug PRINT "DATA = " + GetIniKeyString(ini$, THEME$, INI_KEY_DATA)
  178.                 THEMEDLL$ = GetIniKeyString(ini$, THEME$, INI_KEY_DATA)
  179.                 '' Debug PRINT THEMEDLL$
  180.                 IF bTCODEDDD% = FALSE THEN  ''*** read unencoded string if coding not supported
  181.                     iRC% = ReadStrResource(THEMEDLL$, IDS_EXPIRATION_COMM, DDDate$, LEN(DDDate$)-1)
  182.                 ELSE
  183.                     iRC% = ReadStrResource(THEMEDLL$, IDS_EXPIRATION, DDDate$, LEN(DDDate$)-1)
  184.                 END IF
  185.                 IF bDDOnDay% = TRUE THEN
  186.                     iRCD% = ReadStrResource(THEMEDLL$, IDS_EXPIRATIONDAY, DDDateDay$, LEN(DDDateDay$)-1)
  187.                 END IF
  188.                 IF (iRC% > 0) THEN
  189.                     ''PAUSE DDDate$
  190.                     DropDeadDate$ = DDDate$
  191.                     IF (bTCODEDDD% = TRUE ) THEN
  192.                         iRC% = Encrypt(DropDeadDate$)  '(de)encrypt DDD
  193.                     END IF
  194.                     IF bDDOnDay% = TRUE THEN
  195.                         DropDeadDateDay$ = DDDateDay$
  196.                     END IF
  197.                     bThemeExists% = 1
  198.  
  199.                     end_y% = VAL(MID$(DropDeadDate$, 1, 4))    ''year of drop dead date
  200.                     end_m% = VAL(MID$(DropDeadDate$, 5, 2))    ''month of drop dead date
  201.                     IF bDDOnDay% = TRUE THEN
  202.                         end_d% = (VAL(MID$(DropDeadDateDay$, 1, 2)) + 1)    ''day of start/end
  203.                         start_d% = end_d%
  204.                     END IF
  205.                     start_m% = (end_m%-iNumMonths%+1+12) MOD 12  ''adjust for 1 based month
  206.                     IF start_m% = 0 THEN
  207.                         start_m% = start_m% + 12
  208.                     END IF
  209.                     IF (end_m%-iNumMonths%) < 0 THEN
  210.                         start_y% = end_y% - 1    ''year of current date
  211.                     ELSE
  212.                         start_y% = end_y%
  213.                     END IF
  214.                 END IF
  215.             END IF
  216.             GOTO DoneWithDate
  217.         END IF
  218.     END IF
  219. '$IFDEF CONVERSION
  220.     IF DoesIniKeyExist(ini$, THEME$+CONVERSION_NAME$, INI_KEY_DATA) THEN
  221.         IF DoesFileExist(GetIniKeyString(ini$, THEME$+CONVERSION_NAME$, INI_KEY_DATA), femReadWrite) THEN
  222.             bConversion% = TRUE
  223.             '' get drop dead date
  224.             DDDate$ = STRING$(32, 32) '' 32 spaces - result buffer
  225.             IF bDDOnDay% = TRUE THEN
  226.                 DDDateDay$ = STRING$(32,32)
  227.             END IF
  228.             '' Debug PRINT "DATA = " + GetIniKeyString(ini$, THEME$+CONVERSION_NAME$, INI_KEY_DATA)
  229.             THEMEDLL$ = GetIniKeyString(ini$, THEME$+CONVERSION_NAME$, INI_KEY_DATA)
  230.             '' Debug PRINT THEMEDLL$
  231.             IF bTCODEDDD% = FALSE THEN  ''*** read unencoded string if coding not supported
  232.                 iRC% = ReadStrResource(THEMEDLL$, IDS_EXPIRATION_COMM, DDDate$, LEN(DDDate$)-1)
  233.             ELSE
  234.                 iRC% = ReadStrResource(THEMEDLL$, IDS_EXPIRATION, DDDate$, LEN(DDDate$)-1)
  235.             END IF
  236.             IF bDDOnDay% = TRUE THEN
  237.                 iRCD% = ReadStrResource(THEMEDLL$, IDS_EXPIRATIONDAY, DDDateDay$, LEN(DDDateDay$)-1)
  238.             END IF
  239.             IF (iRC% > 0) THEN
  240.                 '' Debug PRINT DDDate$
  241.                 DropDeadDate$ = DDDate$
  242.                 IF (bTCODEDDD% = TRUE ) THEN
  243.                     iRC% = Encrypt(DropDeadDate$)  '(de)encrypt DDD
  244.                 END IF
  245.                 IF bDDOnDay% = TRUE THEN
  246.                     DropDeadDateDay$ = DDDateDay$
  247.                 END IF
  248.                 bThemeExists% = TRUE
  249.                 IF bWriteNumMonths% = TRUE THEN
  250.                     szNumMonths$ = STRING$(32,32)
  251.                     iRCD% = ReadStrResource(THEMEDLL$, IDS_THEMEPACK_NUM_MONTHS, szNumMonths$, LEN(szNumMonths$)-1)
  252.                     IF (bTCODEDDD% = TRUE ) THEN
  253.                         iFRC% = Encrypt(szNumMonths$)  ''** decrypt nummonths if necessary
  254.                     END IF
  255.                 END IF
  256. ''** compute start date of old SE package
  257.                 iOldNumMonths% = VAL(szNumMonths$)    ''number of months already installed
  258.                 end_y% = VAL(MID$(DropDeadDate$, 1, 4))    ''year of drop dead date
  259.                 end_m% = VAL(MID$(DropDeadDate$, 5, 2))    ''month of drop dead date
  260.                 IF bDDOnDay% = TRUE THEN
  261.                     end_d% = (VAL(MID$(DropDeadDateDay$, 1, 2)) + 1)    ''day of start/end
  262.                     start_d% = end_d%
  263.                 END IF
  264.                 start_m% = (end_m%-iOldNumMonths%+1+12) MOD 12  ''adjust for 1 based month
  265.                 IF start_m% = 0 THEN            '' this fixes a bug in early released themes
  266.                     start_m% = start_m% + 12    '' Dec would be recalc'ed as 0 instead of 12
  267.                 END IF
  268.  
  269.                 IF (end_m%-iOldNumMonths%) < 0 THEN
  270.                     start_y% = end_y% - 1    ''year of current date
  271.                 ELSE
  272.                     start_y% = end_y%
  273.                 END IF
  274. ''** compute new end date for conversion number of months
  275.                 end_m% = (start_m%+iNumMonths%-1) MOD 12     ''DDD is zero based month
  276.                 IF (start_m%+iNumMonths%) > 12 THEN
  277.                     end_y% = start_y% + 1
  278.                 ELSE
  279.                     end_y% = start_y%
  280.                 END IF
  281.  
  282.             END IF
  283.             GOTO DoneWithDate
  284.         END IF
  285.     END IF
  286. '$ENDIF  ''**IFDEF CONVERSION
  287. ''******If none of the checks above succeeded, this theme is to be
  288. ''******freshly installed, so we fall throught to this
  289.  
  290.         ''*** for multitheme install, ddd will be that of last theme listed
  291.     start_m% = GetMonthFromDate(SYSDATETIME$)   ''month of current date
  292.     start_y% = GetYearFromDate(SYSDATETIME$)    ''year of current date
  293.     IF bDDOnDay% = TRUE THEN
  294.         start_d% = GetDayFromDate(SYSDATETIME$)     '' day of current date
  295.         end_d% = start_d%
  296.     ELSEIF bForceWriteDay% = TRUE THEN
  297.         start_day% = 1
  298.         end_d% = start_d%
  299.     END IF
  300.     end_m% = (start_m%+iNumMonths%-1) MOD 12     ''DDD is zero based month
  301.     IF (start_m%+iNumMonths%) > 12 THEN
  302.         end_y% = start_y% + 1
  303.     ELSE
  304.         end_y% = start_y%
  305.     END IF
  306. DoneWithDate:   ''**Done getting or creating a date, we can continue now
  307.  
  308.     ''CustInst list symbols
  309.     CHECKSTATES$ = "CheckItemsState"
  310.     STATUSTEXT$  = "StatusItemsText"
  311.     DRIVETEXT$   = "DriveStatusText"
  312.     CONFIRMTEXTIN$ = "ConfirmTextIn"
  313.     FOR i% = 1 TO 2 STEP 1
  314.         AddListItem CONFIRMTEXTIN$, ""
  315.     NEXT i%
  316.     FOR i% = 1 TO 1 STEP 1
  317.         AddListItem CHECKSTATES$, "ON"
  318.     NEXT i%
  319.     FOR i% = 1 TO 2 STEP 1
  320.         AddListItem STATUSTEXT$, ""
  321.     NEXT i%
  322.  
  323.     FOR i% = 1 TO 7 STEP 1
  324.         AddListItem DRIVETEXT$, ""
  325.     NEXT i%
  326.     ReplaceListItem DRIVETEXT$, 7, DEST$
  327.  
  328.  
  329.     ''Disk cost list symbols
  330.     APPNEEDS$   = "AppNeeds"
  331.     THEMENEEDS$ = "ThemeNeeds"
  332.     OTHERNEEDS$ = "OtherNeeds"
  333.     EXTRACOSTS$ = "ExtraCosts"
  334.     BIGLIST$    = "BigList"
  335.     FOR i% = 1 TO 2 STEP 1        ''I think there are only two items on this list
  336.        AddListItem BIGLIST$, ""
  337.     NEXT i%
  338.  
  339.     FOR i% = 1 TO 26 STEP 1
  340.         AddListItem EXTRACOSTS$, "0"
  341.     NEXT i%
  342.  
  343.     ''Default File Option Variables to install all month files
  344.     FOR i% = 0 TO (iNumFiles%-1) STEP 1
  345.         MONTHOPT%(i%) = 1
  346.     NEXT i%
  347.  
  348. '$IFDEF DEBUG
  349.     i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  350. '$ENDIF ''DEBUG
  351.  
  352. WELCOME:
  353.     szConfirmText$ = WELCOME_TEXT1$ + WELCOME_TEXT1PT2$
  354.     szConfirmText2$ = WELCOME_TEXT2$ + WELCOME_TEXT2PT2$
  355.     DlgCaption$ = "DlgCaption"
  356.     SetSymbolValue DlgCaption$, WELCOME_CAPTION
  357.     ReplaceListItem CONFIRMTEXTIN$, 1, szConfirmText$
  358.     ReplaceListItem CONFIRMTEXTIN$, 2, szConfirmText2$
  359.  
  360.     IF SPLASH% = TRUE THEN
  361.         sz$ = UIStartDlg(CUIDLL$, WELCOMESPLASH, "FSplashDlgProc", WELCOMEHELP, HELPPROC$)
  362.     ELSE
  363.         sz$ = UIStartDlg(CUIDLL$, WELCOME, "FWelcomeDlgProc", WELCOMEHELP, HELPPROC$)
  364.     END IF
  365.  
  366.     IF sz$ = "EXIT" THEN
  367.         UIPopAll
  368.         GOSUB ASKQUIT
  369.         GOTO WELCOME
  370.     ELSEIF sz$ = "REACTIVATE" THEN
  371.         GOTO WELCOME
  372.     ELSE
  373.         UIPop 1
  374.     END IF
  375.  
  376. GETINITIALPATH:
  377.     SetSymbolValue "EditTextIn",THEMEDEST$
  378.     SetSymbolValue "EditFocus", "END"
  379. GETINITIALPATHL1:
  380.     sz$ = UIStartDlg(CUIDLL$, DESTPATH1, "FEditDlgProc", DESTHELP, HELPPROC$)
  381.  
  382.     IF sz$ = "CONTINUE" THEN
  383.         oldthemedest$ = THEMEDEST$
  384.         THEMEDEST$ = GetSymbolValue("EditTextOut")
  385.         ''Validate new path.
  386.         IF IsDirWritable(THEMEDEST$) = 0 THEN
  387.             GOSUB BADPATH
  388.             GOTO GETINITIALPATHL1
  389.         END IF
  390.         UIPop 1
  391.  
  392.         ''Truncate display if too long.
  393.         IF LEN(THEMEDEST$) > 23 THEN
  394.             ReplaceListItem DRIVETEXT$, 7, MID$(THEMEDEST$, 1, 23)+"..."
  395.         ELSE
  396.             ReplaceListItem DRIVETEXT$, 7, THEMEDEST$
  397.         END IF
  398.  
  399.         oldthemedest$ = ""
  400.     ELSEIF sz$ = "REACTIVATE" THEN
  401.         GOTO GETINITIALPATHL1
  402.     ELSEIF sz$ = "EXIT" THEN
  403.         GOSUB ASKQUIT
  404.         GOTO GETINITIALPATHL1
  405.     ELSE
  406.         UIPop 1
  407.     END IF
  408.  
  409.  
  410. CHECK_RES:
  411.  
  412.     szInstallRes$ = GetInstallRes(szThemeResID$)
  413.  
  414.     IF szInstallRes$ = "" THEN
  415.         GOSUB ASKQUIT
  416.         GOTO CHECK_RES
  417.     ELSEIF szInstallRes$ = "0" THEN
  418.         ERR = 21  ''Misc error number - error quit dialog
  419.         GOTO QUIT
  420.     ELSE
  421.         ''PRINT "Install res = " + szInstallRes$
  422.         GOTO CUSTINST
  423.     END IF
  424.  
  425. CUSTINST:
  426.  
  427.     RecalcPath
  428.  
  429.     MonthButton$ = "MonthButton"
  430.     IF GetListItem(CHECKSTATES$, THEMEPACK) = "ON" THEN
  431.         SetSymbolValue MonthButton$,"ON"
  432.     ELSE
  433.         SetSymbolValue MonthButton$,"OFF"
  434.     END IF
  435.     THEMENAME$ = "THEMENAME"
  436.     IF bAnimations% = TRUE THEN
  437.        SetSymbolValue THEMENAME$, "&" + THEME$ + " " + DLG_TEXT_ANIMATIONS
  438.     ELSE
  439.        SetSymbolValue THEMENAME$, "&" + THEME$
  440.     END IF
  441.  
  442.     sz$ = UIStartDlg(CUIDLL$, CUSTINST_NOOPT, "FCustInstDlgProc", OPTIONSHELP, HELPPROC$)
  443.  
  444.     IF sz$ = "CONTINUE" THEN
  445.  
  446.         RecalcPath
  447.  
  448.         ''Install only if it will fit.
  449.         IF bHasEnoughDiskSpace% = FALSE THEN
  450.             GOSUB TOOBIG
  451.             GOTO CUSTINST
  452.         END IF
  453.  
  454. '$IFNDEF CONFIRM
  455.     UIPopALL
  456. '$ENDIF
  457.         GOTO CONFIRM
  458.     ELSEIF sz$ = "PATH" THEN
  459.         GOTO GETPATH
  460.     ELSEIF sz$ = "REMOVE" THEN
  461.         GOSUB REMOVE_THEME
  462.         GOTO CUSTINST
  463.     ELSEIF sz$ = "CHK1" THEN
  464.         GOTO CUSTINST
  465.     ELSEIF sz$ = "BTN2" THEN
  466.         GOSUB DO_MONTHS
  467.         GOTO CUSTINST
  468.     ELSEIF sz$ = "REACTIVATE" THEN
  469.         GOTO CUSTINST
  470.     ELSE
  471.         GOSUB ASKQUIT
  472.         GOTO CUSTINST
  473.     END IF
  474.  
  475. CONFIRM:
  476. '$IFDEF CONFIRM
  477.  
  478.     IF GetListItem(CHECKSTATES$, THEMEPACK) = "ON" THEN
  479.  
  480.         Cursor% = ShowWaitCursor()
  481.  
  482.         szConfirm1$ = CONFIRM_CHOSE_THEME + THEME$
  483. PART1:
  484.         ItemNum% = 1
  485.         TotalItems% = 0
  486.         FOR i% = 0 TO (iNumFiles%-1) STEP 1
  487.             IF MONTHOPT%(i%) = 1 THEN
  488.                 TotalItems% = TotalItems% + 1
  489.             END IF
  490.         NEXT i%
  491.  
  492.         IF (bNoExpire% = TRUE) THEN
  493.             szConfirm1$ = szConfirm1$ + ". "
  494.             GOTO PART2
  495.         END IF
  496.  
  497.         IF (bThemeFileType% = SINGLEFILE) OR (bThemeFileType% = DATAFILE) OR (bThemeFileType% = DATAONLY)THEN
  498. '$IFDEF INTL AND NOT INTL_FR
  499.             IF bDDOnDay% = TRUE THEN
  500.                 szConfirm1$ = szConfirm1$ + CONFIRM_HYPHEN + LTRIM$(STR$(iNumMonths%)) + CONFIRM_1_FILE_THEME_DESC + PAD(LTRIM$(STR$(start_d%))) + DATE_SEPARATOR + PAD(LTRIM$(STR$(start_m%))) + DATE_SEPARATOR + LTRIM$(STR$(start_y%))
  501.             ELSE
  502.                 szConfirm1$ = szConfirm1$ + CONFIRM_HYPHEN + LTRIM$(STR$(iNumMonths%)) + CONFIRM_1_FILE_THEME_DESC + PAD(LTRIM$(STR$(start_m%))) + DATE_SEPARATOR + LTRIM$(STR$(start_y%))
  503.             END IF
  504. '$ELSEIFDEF INTL_FR
  505.             IF bDDOnDay% = TRUE THEN
  506.                 szConfirm1$ = szConfirm1$ + CONFIRM_HYPHEN + LTRIM$(STR$(iNumMonths%)) + CONFIRM_1_FILE_THEME_DESC + PAD(LTRIM$(STR$(start_d%))) + DATE_SEPARATOR + PAD(LTRIM$(STR$(start_m%))) + DATE_SEPARATOR + LTRIM$(STR$(start_y%))
  507.             ELSE
  508.                 szConfirm1$ = szConfirm1$ + CONFIRM_HYPHEN + LTRIM$(STR$(iNumMonths%)) + CONFIRM_1_FILE_THEME_DESC + PAD(LTRIM$(STR$(start_m%))) + DATE_SEPARATOR + LTRIM$(STR$(start_y%))
  509.             END IF
  510.  
  511. '$ELSE
  512.             IF bDDOnDay% = TRUE THEN
  513.                 szConfirm1$ = szConfirm1$ + CONFIRM_HYPHEN + LTRIM$(STR$(iNumMonths%)) + CONFIRM_1_FILE_THEME_DESC + PAD(LTRIM$(STR$(start_m%))) + DATE_SEPARATOR + PAD(LTRIM$(STR$(start_d%))) + DATE_SEPARATOR + LTRIM$(STR$(start_y%))
  514.             ELSE
  515.                 szConfirm1$ = szConfirm1$ + CONFIRM_HYPHEN + LTRIM$(STR$(iNumMonths%)) + CONFIRM_1_FILE_THEME_DESC + PAD(LTRIM$(STR$(start_m%))) + DATE_SEPARATOR + LTRIM$(STR$(start_y%))
  516.             END IF
  517. '$ENDIF
  518.         ELSE
  519.             IF (TotalItems% <> 0) OR (bNoExpire% = TRUE)  THEN
  520.                 FOR i% = 0 TO (iNumMonths%-1) STEP 1
  521.                     CUR_MON_YEAR$ = Month_Year_ToStr((start_m%+i%), (start_y%), " ")
  522.             ''debug
  523.             '' Debug PRINT CUR_MON_YEAR$
  524.                     IF MONTHOPT%(i%) = 1 THEN
  525.                         IF ItemNum% = 1 THEN               ''first
  526.                             IF TotalItems% = 1 THEN
  527.                                 szConfirm1$ = szConfirm1$ + CONFIRM_MULTI_FILE_DESC + CUR_MON_YEAR$
  528.                             ELSE
  529.                                 szConfirm1$ = szConfirm1$ + CONFIRM_MULTI_FILES_DESC + CUR_MON_YEAR$
  530.                             END IF
  531.                         ELSEIF ItemNum% = TotalItems% THEN     ''last
  532.                             szConfirm1$ = szConfirm1$ + CONFIRM_PUCTUATION_LAST + CUR_MON_YEAR$
  533.                         ELSE                                      ''middle
  534.                             szConfirm1$ = szConfirm1$ + CONFIRM_PUCTUATION_MID + CUR_MON_YEAR$
  535.                         END IF
  536.                         ItemNum% = ItemNum% + 1
  537.                     END IF
  538.                 NEXT i%
  539.             END IF
  540.         END IF
  541.         IF TotalItems% = 0 THEN
  542.             IF bThemeFormat% = QUESTION THEN
  543.                 szConfirm1$ = szConfirm1$ + CONFIRM_NO_QUESTIONS
  544.             ELSE
  545.                 szConfirm1$ = szConfirm1$ + CONFIRM_NO_GRAPHICS
  546.             END IF
  547.         ELSE
  548.             SELECT CASE szInstallRes$
  549.                 CASE INI_KEY_XGA
  550.                     szCurRes$ = RES_TEXT_XGA$
  551.                 CASE INI_KEY_VGA
  552.                     szCurRes$ = RES_TEXT_VGA$
  553.                 CASE INI_KEY_EGA
  554.                     szCurRes$ = RES_TEXT_EGA$
  555.                 CASE ELSE
  556.                     szCurRes$ = RES_DONT_CARE
  557.             END SELECT
  558.             IF szCurRes$ <> "" THEN
  559.                 szConfirm1$ = szConfirm1$ + ". " + szCurRes$ + CONFIRM_RESOLUTION
  560.             ELSE
  561.                 szConfirm1$ = szConfirm1$ + "."
  562.             END IF
  563.         END IF
  564. PART2:
  565.         INSTRUCTIONS$ = CONFIRM_INSTRUCT_PART1 + CONFIRM_INSTRUCT_PART2
  566.         CHANGEDATETEXT$ = CONFIRM_CHANGE_DATE
  567.  
  568.          IF (bThemeExists% = FALSE) AND (bNoExpire% = FALSE) THEN
  569.             szConfirm2$ = INSTRUCTIONS$ + CHANGEDATETEXT$
  570.         ELSE
  571.             szConfirm2$ = INSTRUCTIONS$
  572.         END IF
  573.  
  574.         ReplaceListItem CONFIRMTEXTIN$, 1, szConfirm1$
  575.         ReplaceListItem CONFIRMTEXTIN$, 2, szConfirm2$
  576.  
  577.         RestoreCursor Cursor%
  578.     ELSE
  579.         szConfirm1$ = CONFIRM_NO_THEMEPACK
  580.  
  581.         INSTRUCTIONS$ = CONFIRM_INSTRUCT_PART1 + CONFIRM_INSTRUCT_PART2
  582.  
  583.         szConfirm2$ = INSTRUCTIONS$
  584.  
  585.         ReplaceListItem CONFIRMTEXTIN$, 1, szConfirm1$
  586.         ReplaceListItem CONFIRMTEXTIN$, 2, szConfirm2$
  587.     END IF
  588.  
  589. CONFIRML1:
  590.         sz$ = UIStartDlg(CUIDLL$, CONFIRM, "FConfirmDlgProc", 0, "")
  591.         IF sz$ = "CONTINUE" THEN
  592.             UIPopAll
  593.             GOTO INSTALL
  594.         ELSEIF sz$ = "REACTIVATE" THEN
  595.             GOTO CONFIRML1
  596.         ELSE
  597.             UIPop 1
  598.             GOTO CUSTINST
  599.         END IF
  600. '$ENDIF
  601.  
  602. INSTALL:
  603.  
  604. '$IFDEF VERSION
  605.         iR% = VERSION(GetWindowsDir(), szInstIni$, INF_SEC_VERSION)
  606. '$IFDEF VERSION_FIX
  607.         iC% = ContentVersion(GetWindowsDir(), szInstIni$, INI_SECT_CONTENT_VERSION)
  608.         IF (iC% = 1) THEN    ''' TRUE is incompatible content is installed
  609.             iResponse% = MsgYesNo(VERSION_BAD_GENERAL, VERSION_QUIT, VERSION_CAPTION)
  610.             IF iResponse% = NO THEN
  611.                 ERR = ERR_FAIL
  612.                 GOTO QUIT
  613.             ENDIF
  614.         END IF
  615. '$ENDIF
  616. '$ENDIF
  617.  
  618.  
  619.     RecalcPath
  620.  
  621.     IF bHasEnoughDiskSpace% = FALSE THEN
  622.         GOSUB TOOBIG
  623.         GOTO CUSTINST
  624.     END IF
  625.  
  626.     CreateDir THEMEDEST$, cmoNone
  627.  
  628.     RecalcPath
  629.     CopyFilesInCopyList
  630.  
  631. '''********************************************************************************
  632.  
  633.  
  634.     IF GetListItem(CHECKSTATES$, THEMEPACK) = "ON" THEN
  635.         CursorSave% = ShowWaitCursor()
  636.         IF (bThemeExists% = FALSE) OR (bConversion% = TRUE) THEN
  637.             FOR i% = 1 TO iMaxNumTP% STEP 1
  638.                 IF GetIniKeyString(ini$, INI_SEC_THEME_PACKS, INI_KEY_TP+LTRIM$(STR$(i%)) ) <> THEME$ THEN
  639.                     IF DoesIniKeyExist(ini$, INI_SEC_THEME_PACKS, INI_KEY_TP+LTRIM$(STR$(i%)) ) = 0 THEN
  640.                         CreateIniKeyValue ini$, INI_SEC_THEME_PACKS, INI_KEY_TP+LTRIM$(STR$(i%)), THEME$, cmoOverwrite
  641.                         CreateIniKeyValue ini$, INI_SEC_INTERNAL, INI_KEY_DEFAULT_THEME_PACK,LTRIM$(STR$(i%-1)), cmoOverwrite
  642.                         EXIT FOR
  643.                     END IF
  644.                 ELSE
  645.                     EXIT FOR
  646.                 END IF
  647.             NEXT i%
  648.             ''** 7/7/93 - modified to use a master=amzetoon.dll and data=terd.dll
  649.             IF (bMasterInCommon% = 1) THEN
  650.                 CreateIniKeyValue ini$, THEME$, INI_KEY_MASTER, GetSectionKeyFilename(INF_SEC_COMMON, INI_KEY_MASTER), cmoOverwrite
  651.             ELSE
  652.                 CreateIniKeyValue ini$, THEME$, INI_KEY_MASTER, MakePath(THEMEDEST$, GetSectionKeyFilename(INF_SEC_THEME, INI_KEY_MASTER)), cmoOverwrite
  653.             END IF
  654.             CreateIniKeyValue ini$, THEME$, INI_KEY_DATA, MakePath(THEMEDEST$, GetSectionKeyFilename(INF_SEC_THEME, INI_KEY_DATA)), cmoOverwrite
  655.         END IF
  656.         IF bThemeFileType% = SINGLEFILE THEN
  657.             acIniString$ = MakePath(THEMEDEST$, GetSectionKeyFilename(INF_SEC_MONTHS, INF_KEY_FIRST_FILE + szInstallRes$))
  658.             CreateIniKeyValue ini$, THEME$, INI_KEY_FILE, acIniString$, cmoOverwrite
  659.         ELSE
  660.             IF (bThemeFileType% = DATAFILE) OR (bThemeFileType% = DATAONLY) THEN
  661.                 acIniString$ = MakePath(THEMEDEST$, GetSectionKeyFilename(INF_SEC_THEME, INF_KEY_DATA))
  662.                 CreateIniKeyValue ini$, THEME$, INF_KEY_DATA, acIniString$, cmoOverwrite
  663.  
  664.                 IF bThemeFileType% = DATAFILE THEN
  665.                     FOR i%=0 TO (iNumFiles%-1) STEP 1
  666.                         acIniString$ = MakePath(THEMEDEST$, GetSectionKeyFilename(INF_SEC_THEME, INI_KEY_FILE + LTRIM$(STR$(i%)) ) )
  667.                         CreateIniKeyValue ini$, THEME$, INI_KEY_FILE + LTRIM$(STR$(i%)), acIniString$, cmoOverwrite
  668.                         IF bFileSplit% = TRUE THEN
  669.                             acFile1$ = acIniString$
  670.                             acFile2$ =  MakePath(THEMEDEST$, GetSectionKeyFilename(INF_SEC_THEME, INI_KEY_FILE + LTRIM$(STR$(i%)) + LTRIM$(STR$(2)) ) )
  671.                             bRet% = ConcatenateFiles(acFile1$, acFile2$, MakePath(THEMEDEST$, JOIN_TEMP))
  672.                             IF bRet% <> 1 THEN
  673.                                 ERR = ERR_FAIL
  674.                                 GOTO QUIT
  675.                             END IF
  676.                             RemoveFile acFile1$, cmoNone
  677.                             RemoveFile acFile2$, cmoNone
  678.                             RenameFile MakePath(THEMEDEST$, JOIN_TEMP), GetSectionKeyFilename(INF_SEC_THEME, INI_KEY_FILE + LTRIM$(STR$(i%)) )
  679.                         END IF
  680.                     NEXT i%
  681.                 ELSEIF (bThemeFileType% = DATAONLY)  AND (bFileSplit% = TRUE) THEN
  682.                         acFile1$ = MakePath(THEMEDEST$, GetSectionKeyFilename(INF_SEC_THEME, INF_KEY_DATA) )
  683.                         acFile2$ =  MakePath(THEMEDEST$, GetSectionKeyFilename(INF_SEC_THEME, INF_KEY_DATA + LTRIM$(STR$(2)) ) )
  684.                         bRet% = ConcatenateFiles(acFile1$, acFile2$, MakePath(THEMEDEST$, JOIN_TEMP))
  685.                         IF bRet% <> 1 THEN
  686.                             ERR = ERR_FAIL
  687.                             GOTO QUIT
  688.                         END IF
  689.                         RemoveFile acFile1$, cmoNone
  690.                         RemoveFile acFile2$, cmoNone
  691.                         RenameFile MakePath(THEMEDEST$, JOIN_TEMP), GetSectionKeyFilename(INF_SEC_THEME, INF_KEY_DATA )
  692.                END IF
  693.             ELSE
  694.                 FOR i% = 0 TO (iNumMonths%-1) STEP 1
  695.                     CUR_MON_YEAR$ = Month_Year_ToStr((start_m%+i%), (start_y%), "")
  696.                     IF MONTHOPT%(i%) = 1 THEN
  697.                         acIniKey$ = CUR_MON_YEAR$ + szInstallRes$
  698.                         acIniString$ = MakePath(THEMEDEST$, GetSectionKeyFilename(INF_SEC_MONTHS, LTRIM$(STR$(((start_m%-1)+i%) MOD iNumMonths%)) + szInstallRes$))
  699.                         '' Debug PRINT acIniString$
  700.                         CreateIniKeyValue ini$, THEME$, acIniKey$, acIniString$, cmoOverwrite
  701.                     END IF
  702.                 NEXT i%
  703.             END IF
  704.             IF bColor% = TRUE THEN
  705.                 IF szInstallRes$ = INI_KEY_IND THEN
  706.                     CreateIniKeyValue ini$, THEME$, INI_KEY_COLORDATA, MakePath(THEMEDEST$, GetSectionKeyFilename(INF_SEC_THEME,INI_KEY_COLORDATA)), cmoOverwrite
  707.                 ELSE
  708.                     CreateIniKeyValue ini$, THEME$, INI_KEY_COLORDATA + szInstallRes$, MakePath(THEMEDEST$, GetSectionKeyFilename(INF_SEC_THEME,INI_KEY_COLORDATA + szInstallRes$)), cmoOverwrite
  709.                 END IF
  710.             END IF
  711.         END IF
  712.  
  713. '$IFDEF DDD
  714.         IF ((bThemeExists% = FALSE) AND (bNoExpire% = FALSE)) OR (bConversion% = TRUE)THEN
  715.         '' update dropdeaddate
  716.             DropDeadDate$ = LTRIM$(STR$(end_y%))+PAD(LTRIM$(STR$(end_m%)))
  717.             IF (bDDOnDay% = TRUE) OR (bForceWriteDay% = TRUE) THEN
  718.                 DropDeadDateDay$ = PAD(LTRIM$(STR$(end_d%-1)))
  719.             END IF
  720.             ''** 7/7/93 modified to use DATA instead of master
  721.             THEMEDLL$ = MakePath(THEMEDEST$, GetSectionKeyFilename(INF_SEC_THEME, INI_KEY_DATA))
  722.             ''PAUSE THEMEDLL$
  723.             CommercialDDD$ = DropDeadDate$
  724.             IF (bTCODEDDD% = TRUE ) THEN
  725.                 ''PAUSE "Before tcode: " + DropDeadDate$
  726.                 iRC% = Encrypt(DropDeadDate$)
  727.                 ''PAUSE "After tcode: " + DropDeadDate$
  728.             END IF
  729.             IF bWriteComm% = TRUE THEN
  730.                 iRC% = WriteStrResource (THEMEDLL$, IDS_EXPIRATION, DropDeadDate$)
  731.             END IF
  732.             '*** this will write to normal DDD if not separated
  733.             iRC% = WriteStrResource (THEMEDLL$, IDS_EXPIRATION_COMM, CommercialDDD$)
  734.  
  735.             IF (bWriteNumMonths% = TRUE) THEN
  736.                 szNMTD$ = PAD(LTRIM$(STR$(iNMTD%)))
  737.                 IF (bTCODEDDD% = TRUE ) THEN
  738.                     ''PAUSE "Before Tcode:" + szNMTD$
  739.                     iFRC% = Encrypt(szNMTD$)
  740.                     ''PAUSE "After Tcode:" + szNMTD$
  741.                 END IF
  742.                 iRC% = WriteStrResource (THEMEDLL$, IDS_THEMEPACK_NUM_MONTHS, szNMTD$)
  743.             END IF
  744.             IF (bDDOnDay% = TRUE) OR (bForceWriteDay% = TRUE)THEN
  745.                 iRCD% = WriteStrResource (THEMEDLL$, IDS_EXPIRATIONDAY, DropDeadDateDay$)
  746.             END IF
  747.             IF (iRC% < 0) THEN
  748.                 '' Debug PRINT iRC%
  749.                 ERR = ERR_FAIL
  750.                 GOTO QUIT
  751.             END IF
  752.         END IF
  753. '$ENDIF
  754.  
  755.            IF bAnimations% = TRUE THEN
  756.             INIKEYS$ = "IniKeys"
  757.             MakeListFromSectionKeys INIKEYS$, INF_SEC_ANIMATIONS
  758.             IF GetListLength(INIKEYS$) > 0 THEN
  759.                 FOR i% = 1 TO GetListLength(INIKEYS$) STEP 1
  760.                     szIniKey$ = GetListItem(INIKEYS$, i%)
  761.                     szAniFilePath$ = Makepath(THEMEDEST$, GetSectionKeyFilename(INF_SEC_ANIMATIONS, szIniKey$))
  762.                     szAniTagV$ = INI_KEY_ANI + INI_KEY_VGA + szIniKey$
  763.                     szAniTagE$ = INI_KEY_ANI + INI_KEY_EGA + szIniKey$
  764.                     szAniTagX$ = INI_KEY_ANI + INI_KEY_XGA + szIniKey$
  765.                     CreateIniKeyValue ini$, THEME$, szAniTagV$, szAniFilePath$, cmoOverwrite
  766.                     CreateIniKeyValue ini$, THEME$, szAniTagE$, szAniFilePath$, cmoOverwrite
  767.                     CreateIniKeyValue ini$, THEME$, szAniTagX$, szAniFilePath$, cmoOverwrite
  768.                 NEXT i%
  769.             END IF
  770.         END IF
  771.         RestoreCursor CursorSave%
  772.     END IF
  773.  
  774. QUIT:
  775.  
  776.     ON ERROR GOTO ERRQUIT
  777.  
  778.     IF (ERR = 0) AND (bRestart% = TRUE) THEN
  779.         dlg% = EXITRESTART
  780.     ELSEIF ERR = 0 THEN    ''no need to restart
  781.         dlg% = EXITSUCCESS
  782.     ELSEIF ERR= STFQUIT THEN
  783.         dlg% = EXITQUIT
  784.     ELSE
  785.         dlg% = EXITFAILURE
  786.     END IF
  787. QUITL1:
  788.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  789.     IF sz$ = "REACTIVATE" THEN
  790.         GOTO QUITL1
  791.     END IF
  792.     UIPop 1
  793.  
  794.     END
  795.  
  796. ERRQUIT:
  797.     i% = DoMsgBox(ERROR_INSTALL, ERROR_CAPTION, MB_OK+MB_TASKMODAL+MB_ICONHAND)
  798.     END
  799.  
  800.  
  801. ''------------------------------------------------------------------------------
  802. '' FUNCTIONS
  803. ''------------------------------------------------------------------------------
  804.  
  805.  
  806. GETPATH:
  807.     SetSymbolValue "EditTextIn", THEMEDEST$
  808.     SetSymbolValue "EditFocus", "END"
  809. GETPATHL1:
  810.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", DESTHELP, HELPPROC$)
  811.  
  812.     IF sz$ = "CONTINUE" THEN
  813.         oldthemedest$ = THEMEDEST$
  814.         THEMEDEST$ = GetSymbolValue("EditTextOut")
  815.  
  816.         ''Validate new path.
  817.         IF IsDirWritable(THEMEDEST$) = 0 THEN
  818.             GOSUB BADPATH
  819.             GOTO GETPATHL1
  820.         END IF
  821.         UIPop 1
  822.  
  823.         ''Truncate display if too long.
  824.         IF LEN(THEMEDEST$) > 23 THEN
  825.             ReplaceListItem DRIVETEXT$, 7, MID$(THEMEDEST$, 1, 23)+"..."
  826.         ELSE
  827.             ReplaceListItem DRIVETEXT$, 7, THEMEDEST$
  828.         END IF
  829.  
  830.         oldthemedest$ = ""
  831.         GOTO CUSTINST
  832.     ELSEIF sz$ = "REACTIVATE" THEN
  833.         RecalcPath
  834.         GOTO GETPATHL1
  835.     ELSEIF sz$ = "EXIT" THEN
  836.         GOSUB ASKQUIT
  837.         GOTO GETPATHL1
  838.     ELSE
  839.         UIPop 1
  840.         GOTO CUSTINST
  841.     END IF
  842.  
  843.  
  844. DO_MONTHS:
  845. '$IFDEF MONTHS
  846.     MonthOptions        '' calls MonthOptions from MISC.INC
  847. '$ENDIF
  848.     RETURN
  849.  
  850. REMOVE_THEME:
  851. '$IFDEF REMOVE
  852.     RemoveThemeFiles ''included in MISC.INC
  853. '$ENDIF
  854.     RETURN
  855.  
  856.  
  857.  
  858. TOOBIG:
  859.     sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
  860.     IF sz$ = "REACTIVATE" THEN
  861.         RecalcPath
  862.         GOTO TOOBIG
  863.     END IF
  864.     UIPop 1
  865.     RETURN
  866.  
  867.  
  868.  
  869. BADPATH:
  870.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  871.     IF sz$ = "REACTIVATE" THEN
  872.         RecalcPath
  873.         GOTO BADPATH
  874.     END IF
  875.     UIPop 1
  876.     RETURN
  877.  
  878. BADNAME:
  879.     sz$ = UIStartDlg(CUIDLL$, CBBADNAME, "FInfo0DlgProc", 0, "")
  880.     IF sz$ = "REACTIVATE" THEN
  881.         GOTO BADNAME
  882.     END IF
  883.     UIPop 1
  884.     RETURN
  885.  
  886.  
  887. ASKQUIT:
  888.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  889.  
  890.     IF sz$ = "EXIT" THEN
  891.         UIPopAll
  892.         ERROR STFQUIT
  893.     ELSEIF sz$ = "REACTIVATE" THEN
  894.         GOTO ASKQUIT
  895.     ELSE
  896.         UIPop 1
  897.     END IF
  898.     RETURN
  899.  
  900. '**
  901. '** Purpose:
  902. '**     Converts int month and year to a formatted string to display
  903. '** Arguments:
  904. '**     month%  - int corresponding to a month, can be greater than 12
  905. '**               eg. 1 -> JAN, 13 -> JAN.
  906. '**     year%   - int year. If month% is greater than 12 year will be incremented
  907. '** Returns:
  908. '**    String - formatted as "MMM YYYY". eg "JAN 1992"
  909. '*************************************************************************
  910. FUNCTION Month_Year_ToStr (imonth%, iyear%, szSeparator$) STATIC AS STRING
  911.  
  912.     SELECT CASE imonth% MOD 12
  913.         CASE 1
  914.             MON$ = JAN
  915.         CASE 2
  916.             MON$ = FEB
  917.         CASE 3
  918.             MON$ = MAR
  919.         CASE 4
  920.             MON$ = APR
  921.         CASE 5
  922.             MON$ = MAY
  923.         CASE 6
  924.             MON$ = JUN
  925.         CASE 7
  926.             MON$ = JUL
  927.         CASE 8
  928.             MON$ = AUG
  929.         CASE 9
  930.             MON$ = SEP
  931.         CASE 10
  932.             MON$ = OCTOB
  933.         CASE 11
  934.             MON$ = NOV
  935.         CASE 0
  936.             MON$ = DEC
  937.         CASE ELSE
  938.             MON$ = ""
  939.     END SELECT
  940.     IF imonth% > 12 THEN
  941.         acYEAR$ = LTRIM$(STR$(iyear% + 1)) ''month is in next year
  942.     ELSE
  943.         acYEAR$ = LTRIM$(STR$(iyear%))     ''month is in current year
  944.     END IF
  945.     Month_Year_ToStr = MON$ + szSeparator$ + acYEAR$
  946.  
  947. END FUNCTION
  948.  
  949.  
  950.  
  951.  
  952. '**
  953. '** Purpose:
  954. '**     Adds the specified option files to the copy list.
  955. '** Arguments:
  956. '**     ftype%  - type of files to add, one of the following:
  957. '**             APPFILES, THEMEPACK
  958. '** Returns:
  959. '**     none.
  960. '*************************************************************************
  961. SUB AddOptFilesToCopyList (ftype%) STATIC
  962.     IF GetListItem(CHECKSTATES$, ftype%) = "ON" THEN
  963.         SrcDir$ = GetSymbolValue("STF_SRCDIR")
  964.     IF ftype% = THEMEPACK THEN
  965.             IF (GetListLength(BadFileList$) = 0) THEN
  966.                 AddSectionFilesToCopyList INF_SEC_COMMON, SrcDir$, GetWindowsDir()
  967.             ELSE
  968.                 FilesToInstall$ = "FilesToInstall"
  969.                 MakeListFromSectionKeys FilesToInstall$, INF_SEC_COMMON
  970.                 FOR i%=1 TO GetListLength(FilesToInstall$) STEP 1
  971.                     FOR j%=1 TO GetListLength(BadFileList$) STEP 1
  972.                         IF GetListItem(BadFileList$, j%) <> GetSectionKeyFilename(INF_SEC_COMMON, GetListItem(FilesToInstall$, i%)) THEN
  973.                             AddSectionKeyFileToCopyList INF_SEC_COMMON, GetListItem(FilesToInstall, i%), SrcDir$,  GetWindowsDir()
  974.                             EXIT FOR
  975.                         END IF
  976.                     NEXT j%
  977.                 NEXT i%
  978.                 RemoveSymbol FilesToInstall$
  979.             END IF
  980.         IF (bThemeFileType% = MULTIFILE) THEN
  981.             FOR i% = 0 TO (iNumFiles%-1) STEP 1
  982.                 IF MONTHOPT%(i%) = TRUE THEN
  983.                     AddSectionKeyFileToCopyList INF_SEC_MONTHS, LTRIM$(STR$(((start_m%-1)+i%) MOD iNumMonths%)) + szInstallRes$, SrcDir$, THEMEDEST$
  984.                 END IF
  985.             NEXT i%
  986.         ELSEIF bThemeFileType% = SINGLEFILE THEN
  987.             IF MONTHOPT%(0) = 1 THEN
  988.                 AddSectionKeyFileToCopyList INF_SEC_THEME, INF_KEY_FIRST_FILE + szInstallRes$, SrcDir$, THEMEDEST$
  989.             END IF
  990.         ELSEIF bThemeFileType% = DATAFILE THEN
  991.             AddSectionKeyFileToCopyList INF_SEC_THEME, INF_KEY_DATA, SrcDir$, THEMEDEST$
  992.             FOR i% = 0 TO (iNumFiles%-1) STEP 1
  993.                 IF MONTHOPT%(i%) = TRUE THEN
  994.                     AddSectionKeyFileToCopyList INF_SEC_THEME, INI_KEY_FILE + LTRIM$(STR$(i%)), SrcDir$, THEMEDEST$
  995.                 IF bFileSplit% = TRUE THEN
  996.                     AddSectionKeyFileToCopyList INF_SEC_THEME, INI_KEY_FILE + LTRIM$(STR$(i%)) + LTRIM$(STR$(2)), SrcDir$, THEMEDEST$
  997.                 END IF
  998.             END IF
  999.             NEXT i%
  1000.         ELSEIF bThemeFileType% = DATAONLY THEN
  1001.             AddSectionKeyFileToCopyList INF_SEC_THEME, INF_KEY_DATA, SrcDir$, THEMEDEST$
  1002.             IF bFileSplit% = TRUE THEN
  1003.                 AddSectionKeyFileToCopyList INF_SEC_THEME, INF_KEY_DATA + LTRIM$(STR$(2)), SrcDir$, THEMEDEST$
  1004.             END IF
  1005.         END IF
  1006.  
  1007.         IF bColor% = TRUE THEN
  1008.             IF szInstallRes$ = INI_KEY_IND THEN
  1009.                 AddSectionKeyFileToCopyList INF_SEC_THEME, INI_KEY_COLORDATA, SrcDir$, THEMEDEST$
  1010.             ELSE
  1011.                 AddSectionKeyFileToCopyList INF_SEC_THEME, INI_KEY_COLORDATA + szInstallRes$, SrcDir$, THEMEDEST$
  1012.             END IF
  1013.         END IF
  1014.         IF (bThemeExists% = FALSE) OR (bConversion% = TRUE) THEN
  1015.             ''** 7/7/93 - added DATA file, and moved master to win dir
  1016.             ''** AddSectionKeyFileToCopyList INF_SEC_COMMON, INI_KEY_MASTER, SrcDir$, GetWindowsDir()
  1017.             IF bMasterInCommon% <> 1 THEN
  1018.                 AddSectionKeyFileToCopyList INF_SEC_THEME, INI_KEY_MASTER, SrcDir$, THEMEDEST$
  1019.             END IF
  1020.             AddSectionKeyFileToCopyList INF_SEC_THEME, INI_KEY_DATA, SrcDir$, THEMEDEST$
  1021.  
  1022.         END IF
  1023.         IF bAnimations% = TRUE THEN
  1024.             AddSectionFilesToCopyList INF_SEC_ANIMATIONS, SrcDir$, THEMEDEST$
  1025.         END IF
  1026.     END IF
  1027.         SrcDir$ = ""
  1028.     END IF
  1029.  
  1030. END SUB
  1031.  
  1032.  
  1033. '**
  1034. '** Purpose:
  1035. '**     Recalculates disk space for the given option files and sets
  1036. '**     the status info symbol "StatusItemsText".
  1037. '** Arguments:
  1038. '**     ftype% - type of files to add, one of the following:
  1039. '**             APPFILES, THEMEPACK
  1040. '** Returns:
  1041. '**     none.
  1042. '*************************************************************************
  1043. SUB RecalcOptFiles (ftype%) STATIC
  1044.     DIM iExtraDiskSpace%
  1045.     CursorSave% = ShowWaitCursor()
  1046.  
  1047.     iExtraDiskSpace% = 0
  1048.     STILLNEEDSPACE$ = "StillNeedSpace"
  1049.  
  1050.     AddOptFilesToCopyList ftype%
  1051.  
  1052.     fExtra% = 0
  1053.  
  1054.     IF ftype% = THEMEPACK THEN
  1055.         ListSym$ = THEMENEEDS$
  1056.     END IF
  1057.  
  1058.     StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, STILLNEEDSPACE$)
  1059.  
  1060.     cost& = 0
  1061.  
  1062.     FOR i% = 1 TO 26 STEP 1
  1063.         IF VAL(GetListItem(ListSym$, i%)) <> 0 THEN
  1064.             ''PRINT "Disk space for " + STR$(i%) + " = " + GetListItem(ListSym$, i%)
  1065.         END IF
  1066.         cost&  = cost& + VAL(GetListItem(ListSym$, i%))
  1067.     NEXT i%
  1068.     ReplaceListItem STATUSTEXT$, ftype%, STR$(cost& / 1024) + " K"
  1069.  
  1070.     IF fExtra% THEN
  1071.         ReplaceListItem EXTRACOSTS$, ndrive%, "0"
  1072.     END IF
  1073.     RestoreCursor CursorSave%
  1074.     ListSym$ = ""
  1075. END SUB
  1076.  
  1077.  
  1078. '**
  1079. '** Purpose:
  1080. '**     Recalculates disk space and sets option status info according
  1081. '**     to the current destination path.
  1082. '** Arguments:
  1083. '**     none.
  1084. '** Returns:
  1085. '**     none.
  1086. '*************************************************************************
  1087. SUB RecalcPath STATIC
  1088.  
  1089.     CursorSave% = ShowWaitCursor()
  1090.     ClearCopyList
  1091.     RecalcOptFiles THEMEPACK
  1092.     SetDriveStatus
  1093.  
  1094.     RestoreCursor CursorSave%
  1095. END SUB
  1096.  
  1097.  
  1098. '**
  1099. '** Purpose:
  1100. '**     Sets drive status info according to latest disk space calcs.
  1101. '** Arguments:
  1102. '**     none.
  1103. '** Returns:
  1104. '**     none.
  1105. '*************************************************************************
  1106. SUB SetDriveStatus STATIC
  1107.  
  1108.     drive$ = MID$(THEMEDEST$, 1, 1)
  1109.     ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
  1110.     cost& =  VAL(GetListItem(THEMENEEDS$, ndrive%))
  1111.     ''cost& = VAL(GetListItem(APPNEEDS$, ndrive%)) + VAL(GetListItem(THEMENEEDS$, ndrive%))
  1112.     free& = GetFreeSpaceForDrive(drive$)
  1113.     IF cost& > free& THEN
  1114.         bHasEnoughDiskSpace% = FALSE
  1115.     ELSE
  1116.         bHasEnoughDiskSpace% = TRUE
  1117.     END IF
  1118.     ReplaceListItem DRIVETEXT$, 1, drive$ + ":"
  1119.     ReplaceListItem DRIVETEXT$, 2, STR$(cost& / 1024) + " K"
  1120.     ReplaceListItem DRIVETEXT$, 3, STR$(free& / 1024) + " K"
  1121.  
  1122.     IF drive$ = WINDRIVE$ THEN
  1123.         ReplaceListItem DRIVETEXT$, 4, ""
  1124.         ReplaceListItem DRIVETEXT$, 5, ""
  1125.         ReplaceListItem DRIVETEXT$, 6, ""
  1126.     ELSE
  1127.         ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  1128.     cost& =  VAL(GetListItem(THEMENEEDS$, ndrive%))
  1129.     ''cost& = VAL(GetListItem(APPNEEDS$, ndrive%)) + VAL(GetListItem(THEMENEEDS$, ndrive%))
  1130.         IF cost& = 0 THEN
  1131.             ReplaceListItem DRIVETEXT$, 4, ""
  1132.             ReplaceListItem DRIVETEXT$, 5, ""
  1133.             ReplaceListItem DRIVETEXT$, 6, ""
  1134.         ELSE
  1135.             free& = GetFreeSpaceForDrive(WINDRIVE$)
  1136.             ReplaceListItem DRIVETEXT$, 4, WINDRIVE$ + ":"
  1137.             ReplaceListItem DRIVETEXT$, 5, STR$(cost& / 1024) + " K"
  1138.             ReplaceListItem DRIVETEXT$, 6, STR$(free& / 1024) + " K"
  1139.         END IF
  1140.     END IF
  1141. END SUB
  1142.  
  1143.  
  1144. '**
  1145. '** Purpose:
  1146. '**     Appends a file name to the end of a directory path,
  1147. '**     inserting a backslash character as needed.
  1148. '** Arguments:
  1149. '**     szDir$  - full directory path (with optional ending "\")
  1150. '**     szFile$ - filename to append to directory
  1151. '** Returns:
  1152. '**     Resulting fully qualified path name.
  1153. '*************************************************************************
  1154. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  1155.     IF szDir$ = "" THEN
  1156.         MakePath = szFile$
  1157.     ELSEIF szFile$ = "" THEN
  1158.         MakePath = szDir$
  1159.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  1160.         MakePath = szDir$ + szFile$
  1161.     ELSE
  1162.         MakePath = szDir$ + "\" + szFile$
  1163.     END IF
  1164. END FUNCTION
  1165.  
  1166.  
  1167. '**
  1168. '** Purpose:
  1169. '**     Pads a string so that it is two bytes.  Adds leading zero,
  1170. '**
  1171. '** Arguments:
  1172. '**     szNum$  - intended to take a one "digit" string
  1173. '**
  1174. '** Returns:
  1175. '**     String padded with a zero
  1176. '*************************************************************************
  1177. FUNCTION PAD (szNum$) STATIC AS STRING
  1178. IF LEN(szNum$) = 1 THEN
  1179.     PAD = "0"+szNum$
  1180. ELSE
  1181.     PAD = szNum$
  1182. END IF
  1183. END FUNCTION
  1184.  
  1185.  
  1186. '**
  1187. '** Purpose:
  1188. '**     Expands month key to readable string to list in remove listbox
  1189. '**
  1190. '** Arguments:
  1191. '**     szMonthKey$  - key from ini file
  1192. '**
  1193. '** Returns:
  1194. '**     String formatted to list in listbox
  1195. '*************************************************************************
  1196. FUNCTION ExpandMonthKey (szMonthKey$) STATIC AS STRING
  1197.     IF (VAL(MID$(szMonthKey$,4,7))) <> 0 THEN    ''if key does not have year in correct place assume not a valid key
  1198.         szExpandedKey$ = MID$(szMonthKey$, 1, 3) + " " + MID$(szMonthKey$,4,4)   ''MMM YYYY
  1199.                                                                  ''weird string stuff - substring which is a number
  1200.         SELECT CASE MID$(szMonthKey$, 8)
  1201.             CASE INI_KEY_VGA
  1202.                 szExpandedKey$ = szExpandedKey$ + " " + EXPANDED_VGA    ''MMM YYYY RRR
  1203.             CASE INI_KEY_EGA
  1204.                 szExpandedKey$ = szExpandedKey$ + " " + EXPANDED_EGA    ''MMM YYYY RRR
  1205.             CASE INI_KEY_XGA
  1206.                 szExpandedKey$ = szExpandedKey$ + " " + EXPANDED_XGA    ''MMM YYYY RRR
  1207.             CASE INI_KEY_IND
  1208.                 szExpandedKey$ = szExpandedKey$ + EXPANDED_IND    ''MMM YYYY - don't add anything for independent
  1209.             CASE ELSE
  1210.                 szExpandedKey$ = ""  ''don't display other strings
  1211.         END SELECT
  1212.     ELSEIF szMonthKey$ = INI_KEY_COLORDATA THEN
  1213.         szExpandedKey$ = EXPANDED_COLORDATA
  1214.     ELSE
  1215.         szExpandedKey$ = ""    ''String is not known, return empty
  1216.     END IF
  1217.     ExpandMonthKey = szExpandedKey$
  1218.     ''PRINT szExpandedKey$
  1219. END FUNCTION
  1220.  
  1221.